<?php
#
# author: Phil Spagnolo
# (c)2008 South Hill Calvary Chapel
#

$linkList = array("current_sermons.php","archived_sermons.php", "podcast.php");
$textList = array("Current Sermons", "Archived Sermons", "Podcasts");

include_once("./root.inc.php");
include("${root}/mysql/database_info.php");
include("${root}/common.php");
include("${root}/mysql/common.php");

$title = 'Sermon Series';
$meta_key= 'series, topic, topical, sermons, teaching, Bible, God, Jesus, Word, Old Testament, New Testament, scripture';
$meta_desc="A serires of Bible teachings on particular topic given at South Hill Calvary Chapel.";

if (isset($_GET['id']) && isset($_GET['table']) && isset($_GET['title']) ) {
  $id = $_GET['id'];
  $table = $_GET['table'];
  $title = $title.': '.$_GET['title'];
	$title = htmlspecialchars($title, ENT_QUOTES);
	print_html_head($title ,$meta_key,$meta_desc);
	print_java_head(NULL);
	begin_body();
  page_title($title);

  connect_select_test($table);
  $query="SELECT * FROM $table WHERE series_id='$id' ORDER BY date ASC";
  $result=mysql_query($query) or die (mysql_error());
  $num_rows=mysql_num_rows($result);
  sermon_table($result,$num_rows,$table);
}
else if (isset($_GET['id']) || isset($_GET['table']) || isset($_GET['title'])) {
  die ("Error:  Must define id, table, and title not just one.");
} else {
	print_html_head($title ,$meta_key,$meta_desc);
	print_java_head(NULL);
	begin_body();
	page_title($title);
  printf("<div class='paragraph'>\n");
  printf("\tFeatured below are a list of series taught at South Hill Calvary Chapel to address a particular subject.<br/>Click on \"Display\" to see the teachings on each subject.\n");
  printf("</div>\n");

  $table = "sermon_series";
  connect_select_test($table);
  $query="SELECT * FROM $table ORDER BY date DESC";
  $result=mysql_query($query) or die (mysql_error());
  $num_rows=mysql_num_rows($result);
  sermon_series_table($result,$num_rows,$table);
}
printf("<br>\n");

in_page_link(3, false, $linkList, $textList, "");

end_body(0);
//Close the database
mysql_close();
?>









